//
//  RightViewController.m
//  海角音乐
//
//  Created by dllo on 15/8/6.
//  Copyright (c) 2015年 杨元石. All rights reserved.
//

#import "RightViewController.h"

@interface RightViewController ()

@end

@implementation RightViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
     [self createrView];
    
    
    // Do any additional setup after loading the view.
}
-(void)createrView{
 
    UIImageView *back_image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    back_image.image = [UIImage imageNamed:@"素材落日"];
    [back_image setContentScaleFactor:[[UIScreen mainScreen] scale]];
    back_image.contentMode =  UIViewContentModeScaleAspectFill;
    back_image.autoresizingMask = UIViewAutoresizingFlexibleHeight;
    back_image.clipsToBounds  = YES;
    [self.view addSubview:back_image];

    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(30*ADJUSTWIDTH, 120*ADJUSTWIDTH, 32*ADJUSTWIDTH, 32*ADJUSTWIDTH);
    [button addTarget:self action:@selector(buttonAct) forControlEvents:UIControlEventTouchUpInside];
    [button setBackgroundImage:[UIImage imageNamed:@"shouye"] forState:0];
    [self.view addSubview:button];
    

    
    UIButton *shouye = [UIButton buttonWithType:UIButtonTypeCustom];
    shouye.frame = CGRectMake(80*ADJUSTWIDTH, 120*ADJUSTWIDTH, 60*ADJUSTWIDTH, 40*ADJUSTWIDTH);
    [shouye addTarget:self action:@selector(buttonAct) forControlEvents:UIControlEventTouchUpInside];
    shouye.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [shouye setTitleColor:[UIColor whiteColor] forState:0];
    [shouye setTitle:@"推荐" forState:0];
    [self.view addSubview:shouye];

    
    
    
    UIButton *nightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    nightButton.frame = CGRectMake(30*ADJUSTWIDTH, 200*ADJUSTWIDTH, 32*ADJUSTWIDTH, 32*ADJUSTWIDTH);
    [nightButton setBackgroundImage:[UIImage imageNamed:@"yejianmoshi"] forState:0];
    [nightButton addTarget:self action:@selector(nightMode:)
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:nightButton];
    
    UIButton *night = [UIButton buttonWithType:UIButtonTypeCustom];
    night.frame = CGRectMake(80*ADJUSTWIDTH, 200*ADJUSTWIDTH, 60*ADJUSTWIDTH, 40*ADJUSTWIDTH);
    [night addTarget:self action:@selector(nightMode:) forControlEvents:UIControlEventTouchUpInside];
    night.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [night setTitleColor:[UIColor whiteColor] forState:0];
    [night setTitle:@"夜间" forState:0];
    [self.view addSubview:night];
        
    
    UIButton *aboutButton = [UIButton buttonWithType:UIButtonTypeCustom];
    aboutButton.frame = CGRectMake(30*ADJUSTWIDTH, 280*ADJUSTWIDTH, 32*ADJUSTWIDTH, 32*ADJUSTWIDTH);
    [aboutButton setBackgroundImage:[UIImage imageNamed:@"guanyu"] forState:0];
    [aboutButton addTarget:self action:@selector(aboutButton:)
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:aboutButton];
    
    
    UIButton *about = [UIButton buttonWithType:UIButtonTypeCustom];
    about.frame = CGRectMake(80*ADJUSTWIDTH, 280*ADJUSTWIDTH, 60*ADJUSTWIDTH, 40*ADJUSTWIDTH);
    [about addTarget:self action:@selector(aboutButton:) forControlEvents:UIControlEventTouchUpInside];
    about.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [about setTitleColor:[UIColor whiteColor] forState:0];
    [about setTitle:@"关于" forState:0];
    [self.view addSubview:about];
    
    
    UIButton *storageButton = [UIButton buttonWithType:UIButtonTypeCustom];
    storageButton.frame = CGRectMake(30*ADJUSTWIDTH, 360*ADJUSTWIDTH, 32*ADJUSTWIDTH, 32*ADJUSTWIDTH);
    [storageButton setBackgroundImage:[UIImage imageNamed:@"wodeshoucang"] forState:0];
    [storageButton addTarget:self action:@selector(storageButton:)
          forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:storageButton];
    
    
    UIButton *store = [UIButton buttonWithType:UIButtonTypeCustom];
    store.frame = CGRectMake(80*ADJUSTWIDTH, 360*ADJUSTWIDTH, 60*ADJUSTWIDTH, 40*ADJUSTWIDTH);
    [store addTarget:self action:@selector(storageButton:) forControlEvents:UIControlEventTouchUpInside];
    store.titleLabel.font = [UIFont boldSystemFontOfSize:20];
    [store setTitleColor:[UIColor whiteColor] forState:0];
    [store setTitle:@"收藏" forState:0];
    [self.view addSubview:store];
    
}
// 夜间模式
- (void)nightMode:(UIButton *)sender
{
    
    if (sender.selected == YES) {
        
        self.view.window.alpha = 1.0;
        
    } else {
    
        self.view.window.alpha = 0.5;
    }
    
    sender.selected = !sender.selected;
    
}
// 关于
- (void)aboutButton:(UIButton *)sender
{
    
    AboutViewController *likeVc = [[[AboutViewController alloc] init] autorelease];
    LeftSlideViewController *yrs =  (LeftSlideViewController *) [[[[UIApplication sharedApplication]delegate]window]rootViewController];
    UINavigationController *naVc = (UINavigationController *)yrs.mainVC;
    [yrs closeLeftView];
    [naVc pushViewController:likeVc animated:YES];
    
    
}
// 设置按钮
- (void)storageButton:(UIButton *)sender
{
    MyCollectMusicViewController *likeVc = [[[MyCollectMusicViewController alloc] init] autorelease];
    LeftSlideViewController *yrs =  (LeftSlideViewController *) [[[[UIApplication sharedApplication]delegate]window]rootViewController];
    UINavigationController *naVc = (UINavigationController *)yrs.mainVC;
    [yrs closeLeftView];
    [naVc pushViewController:likeVc animated:YES];
    
}



// 返回首页
- (void)buttonAct
{
   
//    // 通过app 回到主Window用来显示抽屉的VC
    AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    // 由关闭状态打开抽屉
    if (tempAppDelegate.leftVc.closed)
    {
        [tempAppDelegate.leftVc openLeftView];
    }
    // 关闭抽屉
    else
    {
        [tempAppDelegate.leftVc closeLeftView];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
